home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
AMICUS
/
AMICUS26.ADF
/
SoundScape
/
LatticeExamples
/
chord.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-01-26
|
2KB
|
131 lines
/* Chord.c
(c) 1987 Todor Fay
Lattice version
To compile:
lc1 chord
lc2 -v chord
To link:
alink with chord.with
or
blink with chord.with
*/
#include "exec/types.h"
#include "exec/exec.h"
#include "intuition/intuition.h"
#include "soundscape.h"
/* First, the data for the icon in the Patch Panel */
UWORD chorddata[] = {
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
6, 0,
1, 32768,
255, 57344,
1, 32768,
6, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0, 96,
0, 96,
3072, 96,
3072, 992,
3072, 992,
3072, 96,
3072, 96,
31744, 992,
31744, 992,
0, 96,
0, 96,
0, 992,
0, 992,
0, 0,
0, 0,
0, 0,
};
struct Image chordimage = { 0,0,32,16,2,chorddata,3,0,0 };
/* This module has a port id. */
unsigned short thisport;
opencode(direction)
/* Always happy to open. */
unsigned char direction;
{
return(1);
}
closecode(direction)
unsigned char direction;
{
return(1);
}
outcode(event)
/* Strip the channel information from the status byte. If
this is a NOTEON or NOTEOFF event, create two new events,
copy the status and velocity into them, add constants to
their note values, and ship off all three. Otherwise,
free this event.
*/
struct Note *event;
{
struct Note *secondevent;
unsigned char status;
status = event->status & 0xF0;
if ((status == NOTEON) || (status == NOTEOFF)) {
secondevent = (struct Note *) AllocNode(NOTE);
if (secondevent) {
secondevent->status = event->status;
secondevent->velocity = event->velocity;
secondevent->value = event->value + 4;
Send(thisport,secondevent);
}
secondevent = (struct Note *) AllocNode(NOTE);
if (secondevent) {
secondevent->status = event->status;
secondevent->velocity = event->velocity;
secondevent->value = event->value + 7;
Send(thisport,secondevent);
}
Send(thisport,event);
}
else FreeNode(event);
}
long SoundScapeBase;
main() {
SoundScapeBase = OpenLibrary("soundscape.library",0);
if (SoundScapeBase) {
CloseLibrary(SoundScapeBase);
thisport = AddMidiPort(opencode,closecode,0,outcode,&chordimage,
&chordimage,-1,"chord maker");
SetTaskPri(FindTask(0),-20);
while (MidiPort(thisport)) Delay(100);
}
}